<template>
	<view>
		<view class="itembox" v-for="(i,k) in list" :key="k">
			<image :src="i.Image" style="width: 88rpx;height: 88rpx;border-radius: 50%;" mode=""></image>
			<view class="r-box">
				<view class="top-info">
					<view class="nameinfo">
						{{i.name}}
					</view>
					<view class="timeinfo">
						{{i.time}}
					</view>
				</view>
				<view class="centont-txt">
					{{i.content}}
				</view>
			</view>
		</view>
		<view class="zanwu" v-if="list.length<0">
			暂无评价
		</view>
	</view>
</template>

<script>
	import ikz from '@/pages/Common/tools.js';
	export default {
		data( ) {
			return {
				adminImgPath: getApp( ).globalData.adminImgPath,
				list: [ {
						Image: '/static/empty.png',
						name: '蝎子莱莱',
						time: '2024-12-24 17:50',
						content: '服务周到热情似火，挑不出毛病来。'
					},
					{
						Image: '/static/empty.png',
						name: '蝎子莱莱',
						time: '2024-12-24 17:50',
						content: '服务周到热情似火，挑不出毛病来。'
					}
				],
				page: 1,
				size:10
			};
		},
		onShow( ) {
			this.getinit( )
		},
		methods: {
			getinit( ) {
				var path = '/xyb/supermarket/order/user_evaluation';
				var data = {
					page: this.page,
					type: 'user'
				};
				ikz.request( path, data, res => {
					console.log( "评价列表", res )
					if ( res.data.code ) {
						//商家信息

						if ( this.page === 1 ) {
							// 第一页直接赋值
							this.list = res.data.data || [ ];
						} else {
							// 后续页数拼接数据
							this.list = [ ...this.list, ...( res.data.data || [ ] ) ];
						}
						// 如果没有数据了，显示提示
						if ( res.data.data.length < this.size ) {
							uni.showToast( {
								title: '没有更多数据了',
								icon: 'none'
							} );
						}
					} else {
						uni.showModal( {
							title: '提示',
							content: res.data.msg,
							showCancel: false,
							success: function( res ) {}
						} );
					}
				} )
			}
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #F5F5F5;
	}

	.zanwu {
		width: 100%;
		height: 50rpx;
		margin: 22rpx auto;
		text-align: center;
	}

	.itembox {
		width: 100%;
		height: 148rpx;
		background-color: #fff;
		padding: 22rpx 30rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.r-box {
			width: 594rpx;
			height: 148rpx;
			display: flex;
			align-items: center;
			justify-content: space-evenly;
			flex-direction: column;
			margin-left: 8rpx;

			.top-info {
				width: 100%;
				height: 34rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.nameinfo {
					width: 50%;
					height: 34rpx;
					font-weight: 400;
					font-size: 22rpx;
					color: #666666;
					text-align: left;
				}

				.timeinfo {
					width: 50%;
					height: 34rpx;
					font-weight: 400;
					font-size: 22rpx;
					color: #BCBCBC;
					text-align: right;
				}
			}

			.centont-txt {
				width: 100%;
				height: 38rpx;
				font-weight: 400;
				font-size: 26rpx;
				color: #000000;
				text-align: left;
			}
		}
	}
</style>